package com.aegean.onlinebook.service.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.aegean.onlinebook.model.BigType;
import com.aegean.onlinebook.service.business.ServiceBusiness;
import com.opensymphony.xwork2.ActionSupport;

@Controller("CUDBigTypeAction")
@Scope("prototype")
public class CUDBigType extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Resource
	ServiceBusiness business;
	private BigType bigType;
	private boolean success;

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public BigType getBigType() {
		return bigType;
	}

	public void setBigType(BigType bigType) {
		this.bigType = bigType;
	}

	@Override
	public String execute() throws Exception {
		try {
			success=business.addBigType(bigType);
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return  SUCCESS;
		}
	}
	public String edit() throws Exception {
		try {
			success=business.editBigType(bigType);
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return  SUCCESS;
		}
	}

}
